﻿using System;

#if WINDOWS_PHONE
namespace Fibre.WP7.Threading
#else
#if SILVERLIGHT
namespace Fibre.Silverlight.Threading
#else
namespace Fibre.Threading
#endif
#endif
{
    /// <summary>
    /// Base work conext, has common fluent methods for IWorkContext and IWorkContext&gt;TResult&lt;
    /// </summary>
    public interface IWorkContextBase : IAddWork
    {
        /// <summary>
        /// Performs the work.
        /// </summary>
        ICanWait PerformWork();

        /// <summary>
        /// Builds a Async Work Item from the work context.
        /// </summary>
        /// <returns></returns>
        WorkItem Build();

        /// <summary>
        /// Whens all work completes. Including chained work (work added during completed callbacks).
        /// </summary>
        /// <param name="completedCallback">The completed callback.</param>
        /// <returns></returns>
        AsyncWork WhenAllComplete(Action completedCallback);
    }
}